radar: port 3-tier lead tracking + vision-coast + Rivian yRel correction#2
Open
rawsignal wants to merge 1 commit into
Open
radar: port 3-tier lead tracking + vision-coast + Rivian yRel correction#2rawsignal wants to merge 1 commit into
rawsignal wants to merge 1 commit into
Conversation
Ports the radard lead-tracking work from the sunnypilot fork
(spicysapling/sunnypilot @ fix/lead-track-switching, through aa23300729)
into this Rivian fork. User-selectable via a new "Radar Lead Tracking"
cruise-panel selector (LeadTrackingMode, default = Stable Lead / Tier 2):
- Tier 1 (Stock): stock per-frame greedy vision<->radar match.
- Tier 2 (Stable Lead): lateral-weighted id hysteresis biases the held
radar track, killing per-frame lead flicker where track ids are stable.
- Tier 3 (Stable + Vision Coast): also holds the last-good lead through a
sudden close/slow radar phantom the camera doesn't corroborate (chosen
track-id changed, or radar lateral jump while vision held still), bounded
by a 1 s cap, with a 40 m close-cut-in failsafe that never coasts past a
near lead.
Rivian radar lateral correction: the opendbc Mando interface computes
yRel = 0.5 * -sin(az) * dist; the 0.5 over-compresses the lateral offset so
prob_y can't separate an adjacent-lane car from the in-path lead. Corrected
brand-gated at radar-point ingestion to a 0.70 effective scale (x1.4) so the
matcher, the stored Track, and the emitted lead all see the same lateral;
dRel/vRel untouched, non-Rivian brands are a no-op. Validated on the
sunnypilot corpus (tier-2 brake-jumps -4.7%, 0 gross-streak regressions).
Observability: new radarStateSP cereal message (leadOne/leadTwoCoasting)
drives an opt-in per-chevron coast tint + dev-UI COAST element, gated by
ShowVisionCoastOnChevron (default off).
Validated on macOS: 23 unit tests pass (test_radard_tiers.py), cereal and
params_pyx rebuilt, radarStateSP round-trips, new param keys resolve.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 9f0e77c)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the radard lead-tracking work from the sunnypilot fork (spicysapling/sunnypilot @ fix/lead-track-switching, through aa23300729) into this Rivian fork. User-selectable via a new "Radar Lead Tracking" cruise-panel selector (LeadTrackingMode, default = Stable Lead / Tier 2):
Rivian radar lateral correction: the opendbc Mando interface computes yRel = 0.5 * -sin(az) * dist; the 0.5 over-compresses the lateral offset so prob_y can't separate an adjacent-lane car from the in-path lead. Corrected brand-gated at radar-point ingestion to a 0.70 effective scale (x1.4) so the matcher, the stored Track, and the emitted lead all see the same lateral; dRel/vRel untouched, non-Rivian brands are a no-op. Validated on the sunnypilot corpus (tier-2 brake-jumps -4.7%, 0 gross-streak regressions).
Observability: new radarStateSP cereal message (leadOne/leadTwoCoasting) drives an opt-in per-chevron coast tint + dev-UI COAST element, gated by ShowVisionCoastOnChevron (default off).
Validated on macOS: 23 unit tests pass (test_radard_tiers.py), cereal and params_pyx rebuilt, radarStateSP round-trips, new param keys resolve.
(cherry picked from commit 9f0e77c)